<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改登记信息</title>
</head>
<body>
<div style="margin-left: 50%">
    <form id="form-health-edit" th:action="@{/editHealthInfo}" method="post">
        <input type="hidden" name="id" th:value="${session.user.id}">
        <div>
            健康状况：<input id="HealthState" name="HealthState" type="text" th:value="${healthInfo != null ? healthInfo.healthState : ''}">
        </div>
        <div>
            温度：<input id="temperature" name="temperature" type="text" th:value="${healthInfo != null ? healthInfo.temperature : ''}">
        </div>
        <div>
            是否外出：
            <input type="radio" name="isOut" value="false" th:checked="${healthInfo != null ? healthInfo.isOut == false : false}">否
            <input type="radio" name="isOut" value="true" th:checked="${healthInfo != null ? healthInfo.isOut == true : false}">是
        </div>
        <div>
            工作状态：<input id="workState" name="workState" type="text" th:value="${healthInfo != null ? healthInfo.workState : ''}">
        </div>
        <div>
            备注：<input id="memo" name="memo" type="text" th:value="${healthInfo != null ? healthInfo.memo : ''}">
        </div>
        <div>
            <input type="submit" class="button" value="保存">
        </div>
    </form>
</div>
</body>
<div th:replace="common :: common"></div>
</html>
<script>
    $(function () {
        $("#form-edit").validate({
            submitHandler: function(form){
                form.submit();   //提交表单
            },
            rules:{
                HealthState:{
                    required: true
                },
                temperature:{
                    required: true
                },
                isOut:{
                    required: true,
                },
                workState:{
                    required: true,
                },
                memo:{
                    required: true,
                }
            },
            focusCleanup: true
        });
    });
</script>